<?php
require_once('../../../conexiones/cn.php');

if(isset($_GET['id_comuna'])){
	// begin Recordset
	$colname__rsSector = '-1';
	if (isset($_GET['id_comuna'])) {
	  $colname__rsSector = $_GET['id_comuna'];
	}
	$query_rsSector = sprintf("SELECT 
								id_sector, id_comuna, nombre_sector, des_sector 
								FROM sector
								WHERE id_comuna = %s", $colname__rsSector);
	$rsSector = $cn->SelectLimit($query_rsSector) or die($cn->ErrorMsg());
	$totalRows_rsSector = $rsSector->RecordCount();
	// end Recordset
}

?>

<?php if(isset($_GET['id_comuna'])){ ?>
Sector:
	<select name="id_sector" id="id_sector">
	  <?php
	  while(!$rsSector->EOF){
	?>
	  <option value="<?php echo $rsSector->Fields('id_sector')?>"><?php echo $rsSector->Fields('nombre_sector')?></option>
	  <?php
		$rsSector->MoveNext();
	  }
	  $rsSector->MoveFirst();
	?>
	</select>
<?php } ?>
<?php
if(isset($rsSector))
	$rsSector->Close();
?>
